#include <stdio.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int main(int argc, char const* argv[])
{
    struct in_addr addr;

    if (argc != 2)
    {
        printf("usage: %s xxx.xxx.xxx.xxx\n", argv[0]);
        exit(1);
    }

    if (inet_aton(argv[1], &addr) == 0)
    {
        printf("usage: %s xxx.xxx.xxx.xxx\n", argv[1]);
        exit(1);
    }

    printf("0x%x\n", htonl(addr.s_addr));

    return 0;
}
